# # 
# APP-build := msnet

# # 头文件路径
# INCLUDES += -I ./  -I ./3rd
# INCLUDES += -I ./3rd/librtmp  
# INCLUDES += -I ./utils

# LDFLAGS += ./3rd/librtmp/librtmp.a

# # 编译选项
# # CXXFLAGS += $(INCLUDES) -DASIO_STANDALONE -DASIO_HAS_STD_CHRONO
# # CXXFLAGS += -DUSE_PUB_RTMP
# # CXXFLAGS += -DUSE_FLV_SRV

# # 生成可执行程序链接库
# LDFLAGS += -ldl -lrt -pthread -Wl,-rpath=./

# # 源文件
# DIRS += utils
# SRCS += Publisher.cpp \
# 		TcpBusiness.cpp \
# 		Conf.cpp \
# 		TcpConn.cpp \
# 		TcpConnManager.cpp \
# 		rtmp/RtmpWriter.cpp \
# 		Main.cpp \

# -include scripts/compile.mk

# export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
# g++ -g -Wall src/main.c -I/root/share/CVS_CMS/PUBLIC/spdlog/include -L /root/share/CVS_CMS/PUBLIC/spdlog -lspdloginterface --std=c++11 -o main.out

# g++ -g -Wall src/main.c -I/root/share/CVS_CMS/PUBLIC/spdlog/include -L/usr/local/lib/ -lavcodec -lavformat --std=c++11 -o main.out

#目标文件
#TARGET=libRtmpWriter.so
TARGET=libRtmpWriter.a
#源文件目录
SCR = utils
#编译选项
CPPFLAGS = -g
ROOT_DIR := $(shell pwd)
LNK_RTMP = -L$(ROOT_DIR)/3rd/librtmp -lrtmp -pthread -std=c++11

VPATH = utils:$(ROOT_DIR)/3rd/librtmp

SPEC_INC := -I$(ROOT_DIR)/3rd/ -I$(ROOT_DIR)/3rd/comm-inc/include/common

NOMAL_OBJS := $(ROOT_DIR)/$(SCR)/RtmpWriter.o \
			  $(ROOT_DIR)/$(SCR)/Sps.o
	
$(TARGET):$(NOMAL_OBJS)
#	 ld  $(CPPFLAGS) $(NOMAL_OBJS) -o $(TARGET) -shared -fPIC -lc 
	ar -rc -o $(TARGET) $(NOMAL_OBJS) 


#依赖头、源文件和公共头
$(NOMAL_OBJS):  %.o : %.cpp %.h
	g++ $(CPPFLAGS) $(SPEC_INC) $(LNK_RTMP) -o $@ -c -fPIC $(subst .o,.cpp,$@)

.PHONY: clean 
clean: 
	rm -rf $(TARGET)
	rm -rf $(NOMAL_OBJS)